package com.pug.controller;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.pug.pojo.LoginUser;
import com.pug.pojo.SysLoginUser;
import com.pug.service.user.SysLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录验证
 *
 * @author ruoyi
 */
@RestController
public class SysLoginController {
    @Autowired
    private SysLoginService loginService;

    /**
     * 登录方法
     *
     * @return 结果
     */
    @PostMapping("/login")
    public LoginUser login(@RequestBody  SysLoginUser sysLoginUser) throws JsonProcessingException {
        // 生成令牌
        return loginService.login(sysLoginUser.getUsername(), sysLoginUser.getPassword());
    }

}
